package case1_4;

public class case4 {
    public static void main(String[] args) {
        /*百钱白鸡：我国古代数学家张丘建在《算经》一书中提出的数学问题：鸡翁一值钱五，鸡母一值钱三，鸡雏三值钱一，
         百钱买百鸡，问鸡翁、鸡母、鸡雏各几何？*/
        /*for (int i = 0; i <= 100; i++){
            for (int j = 0; j <= 100; j++) {
                for (int k = 0; k <= 100; k++) {
                    if(i*5 +j*3 + k/3 ==100 && i + j + k == 100){
                        if (k % 3 ==0) {
                            System.out.print("鸡翁：" + i + "只，");
                            System.out.print("鸡母：" + j + "只，");
                            System.out.println("鸡雏：" + k + "只");
                        }
                    }
                }
            }
        }*/
        for (int i = 0; i <= 20; i++) {
            for (int j = 0; j <= 33; j++) {
                int k = 100 - i - j;
                if (k % 3 == 0 && i * 5 + j * 3 + k / 3 == 100) {
                    System.out.print("鸡翁：" + i + "只，");
                    System.out.print("鸡母：" + j + "只，");
                    System.out.println("鸡雏：" + k + "只");
                }
            }
        }
    }
}
